package osami.communication.translate;

import java.util.Vector;

import osami.communication.OsamiIdentifier;

public class FindServiceMessage extends Message
{
	protected String iInterfaceName = null;
	protected String iMethodName = null;
	protected OsamiIdentifier iDestination = null;
	protected Vector<OsamiIdentifier> iCallPath = new Vector<OsamiIdentifier>();

	protected int iHopCounter = 0;
	
	
	public FindServiceMessage( int aCallNumber )
	{
		iCallNumber = aCallNumber;
	}
	
	
	public void setDestination( OsamiIdentifier aDestination )
	{
		iDestination = aDestination;
	}
	
	
	public void setCaller( OsamiIdentifier aCaller )
	{
		iCallPath = new Vector<OsamiIdentifier>();
		iCallPath.add( aCaller );
	}
	
	
	public void addToCallPath( OsamiIdentifier aCaller )
	{
		iCallPath.add( aCaller );
	}
	
	
	public void setInterfaceName( String aInterfaceName )
	{
		iInterfaceName = aInterfaceName;
	}
	
	
	public String getInterfaceName()
	{
		return iInterfaceName;
	}

	
	public void setMethodName( String aMethodName )
	{
		iMethodName = aMethodName;
	}
	
	
	public String getMethodName()
	{
		return iMethodName;
	}

	
	public Vector<OsamiIdentifier> getCallPath()
	{
		return iCallPath;
	}
	
	
	public void setCallPath( Vector<OsamiIdentifier> aCallPath )
	{
		iCallPath = aCallPath;
	}
	
	
	/**
	 * Returns the last element of the call path
	 * 
	 */
	public OsamiIdentifier getSender()
	{
		return iCallPath.get( iCallPath.size() - 1 );
	}
	
	
	public int getType()
	{
		return Message.FIND_SERVICE;
	}

	
	public OsamiIdentifier getDestination()
	{
		return iDestination;
	}
	
	
	public boolean isRequest()
	{
		return true;
	}
	
	
	public void setHopCounter( int aHopCounter )
	{
		iHopCounter = aHopCounter;
	}
	
	
	public int getHopCounter()
	{
		return iHopCounter;
	}
}
